<html>
<head><meta charset="utf-8"><title>TAIT stabilization report · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html">TAIT stabilization report</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="243060564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243060564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243060564">(Jun 17 2021 at 18:15)</a>:</h4>
<p>Here is a draft stablization report for TAITs:</p>
<p><a href="https://hackmd.io/o9KO-D8aSb6bJgQ1froVTA">https://hackmd.io/o9KO-D8aSb6bJgQ1froVTA</a></p>
<p>Comments welcome.</p>



<a name="243061395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243061395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243061395">(Jun 17 2021 at 18:21)</a>:</h4>
<p><strong>Non-trivial type aliases</strong></p>



<a name="243061414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243061414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243061414">(Jun 17 2021 at 18:21)</a>:</h4>
<p>So, I think we should be more clear here</p>



<a name="243061472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243061472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243061472">(Jun 17 2021 at 18:22)</a>:</h4>
<div class="codehilite"><pre><span></span><code>struct Y&lt;T&gt;(T);
type X = Y&lt;impl Sized&gt;;
</code></pre></div>
<p>is fine</p>



<a name="243061505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243061505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243061505">(Jun 17 2021 at 18:22)</a>:</h4>
<p>but</p>
<div class="codehilite"><pre><span></span><code>type Z = fn(impl Sized);
</code></pre></div>
<p>doesn't seem to be</p>



<a name="243062008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243062008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243062008">(Jun 17 2021 at 18:25)</a>:</h4>
<p>Though I guess that second example seems very specific to <code>fn</code>s</p>



<a name="243062115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243062115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243062115">(Jun 17 2021 at 18:26)</a>:</h4>
<p>minor detail, it talks about the RFC but it's never linked</p>



<a name="243062159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243062159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243062159">(Jun 17 2021 at 18:26)</a>:</h4>
<p>ohh I see at the top there's a place to fill out with that info <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="243062691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243062691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243062691">(Jun 17 2021 at 18:30)</a>:</h4>
<blockquote>
<p>This can effectively be desugared into a TAIT whose scope encompasses just the impl. Roughly like the following:</p>
</blockquote>
<p>This desugaring seems not quite right; I would expect that <code>type Future = impl Future&lt;Output = Response&gt;;</code> to be in the module, not the impl</p>



<a name="243063516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243063516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243063516">(Jun 17 2021 at 18:35)</a>:</h4>
<p>For reference,</p>
<div class="codehilite"><pre><span></span><code>type Z = fn() -&gt; impl Sized;

fn bar() -&gt; Z {
    || 0u32
}
</code></pre></div>
<p>also doesn't work. So my example above doesn't just apply when TAIT is an argument</p>



<a name="243064011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243064011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243064011">(Jun 17 2021 at 18:38)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20stabilization.20report/near/243060564">said</a>:</p>
<blockquote>
<p>Comments welcome.</p>
</blockquote>
<p>can we just comment with <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span> and <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span> emojis?</p>



<a name="243064052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243064052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243064052">(Jun 17 2021 at 18:38)</a>:</h4>
<div class="codehilite"><pre><span></span><code>// Illegal: cannot use MyFuture in a field type
</code></pre></div>
<p>Oof, that's rough. I feel like that's a really nice to have. But I guess the semantics become tough: you could theoretically imagine that using it there could be a "defining use", or you could have a defining use elsewhere but just have the struct store the type</p>



<a name="243064146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243064146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243064146">(Jun 17 2021 at 18:39)</a>:</h4>
<p>I.e. I could imagine that a function might create an iterator and you would want to store that iterator in a struct</p>



<a name="243064521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243064521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243064521">(Jun 17 2021 at 18:42)</a>:</h4>
<p>you can do it with a submodule</p>



<a name="243064538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243064538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243064538">(Jun 17 2021 at 18:42)</a>:</h4>
<p>I do want to eventually support "impl Trait everywhere"</p>



<a name="243064551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243064551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243064551">(Jun 17 2021 at 18:42)</a>:</h4>
<p>Other than that, the only other comment I have is: it would be nice to at least mention how these are defined logically/in Chalk. I think the remaining issue there is the interaction with WF and implied bounds (<a href="https://github.com/rust-lang/rust/issues/335">#335</a>), but I'm not sure if there's a model where the hidden type "isn't known"</p>



<a name="243064555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243064555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243064555">(Jun 17 2021 at 18:42)</a>:</h4>
<p>that's kind of the next RFC here, I've been putting off writing it because I would have to bring various things back in cache...</p>



<a name="243064588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243064588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243064588">(Jun 17 2021 at 18:42)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20stabilization.20report/near/243064551">said</a>:</p>
<blockquote>
<p>Other than that, the only other comment I have is: it would be nice to at least mention how these are defined logically/in Chalk. I think the remaining issue there is the interaction with WF and implied bounds (<a href="https://github.com/rust-lang/rust/issues/335">#335</a>), but I'm not sure if there's a model where the hidden type "isn't known"</p>
</blockquote>
<p>can you edit in a section with FIXME</p>



<a name="243064602"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243064602" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243064602">(Jun 17 2021 at 18:42)</a>:</h4>
<p>and maybe add other FIXME lines for other comments?</p>



<a name="243064613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20stabilization%20report/near/243064613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20stabilization.20report.html#243064613">(Jun 17 2021 at 18:42)</a>:</h4>
<p>I can't edit it right now, finishing up something else</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>